using System;
using System.Drawing;
using System.Windows.Forms;

namespace GomokuGame
{
    /// <summary>
    /// 游戏模式选择对话框
    /// </summary>
    public partial class GameModeDialog : Form
    {
        private RadioButton radioHumanVsHuman;
        private RadioButton radioHumanVsAI;
        private RadioButton radioAIVsAI;
        private Button btnOK;
        private Button btnCancel;
        private Label lblTitle;

        public GameMode SelectedGameMode { get; private set; }

        public GameModeDialog()
        {
            InitializeComponent();
            Load += GameModeDialog_Load;
        }

        private void InitializeComponent()
        {
            this.lblTitle = new Label();
            this.radioHumanVsHuman = new RadioButton();
            this.radioHumanVsAI = new RadioButton();
            this.radioAIVsAI = new RadioButton();
            this.btnOK = new Button();
            this.btnCancel = new Button();
            this.SuspendLayout();

            // lblTitle
            this.lblTitle.AutoSize = true;
            this.lblTitle.Font = new Font("微软雅黑", 12F, FontStyle.Bold);
            this.lblTitle.Location = new Point(20, 20);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(120, 21);
            this.lblTitle.Text = "选择游戏模式";

            // radioHumanVsHuman
            this.radioHumanVsHuman.AutoSize = true;
            this.radioHumanVsHuman.Font = new Font("微软雅黑", 10F);
            this.radioHumanVsHuman.Location = new Point(30, 60);
            this.radioHumanVsHuman.Name = "radioHumanVsHuman";
            this.radioHumanVsHuman.Size = new Size(100, 20);
            this.radioHumanVsHuman.Text = "人人对战";
            this.radioHumanVsHuman.UseVisualStyleBackColor = true;
            this.radioHumanVsHuman.Checked = true;

            // radioHumanVsAI
            this.radioHumanVsAI.AutoSize = true;
            this.radioHumanVsAI.Font = new Font("微软雅黑", 10F);
            this.radioHumanVsAI.Location = new Point(30, 90);
            this.radioHumanVsAI.Name = "radioHumanVsAI";
            this.radioHumanVsAI.Size = new Size(100, 20);
            this.radioHumanVsAI.Text = "人机对战";
            this.radioHumanVsAI.UseVisualStyleBackColor = true;

            // radioAIVsAI
            this.radioAIVsAI.AutoSize = true;
            this.radioAIVsAI.Font = new Font("微软雅黑", 10F);
            this.radioAIVsAI.Location = new Point(30, 120);
            this.radioAIVsAI.Name = "radioAIVsAI";
            this.radioAIVsAI.Size = new Size(100, 20);
            this.radioAIVsAI.Text = "自动演示";
            this.radioAIVsAI.UseVisualStyleBackColor = true;

            // btnOK
            this.btnOK.DialogResult = DialogResult.OK;
            this.btnOK.Font = new Font("微软雅黑", 9F);
            this.btnOK.Location = new Point(80, 170);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new Size(75, 30);
            this.btnOK.Text = "确定";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += BtnOK_Click;

            // btnCancel
            this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("微软雅黑", 9F);
            this.btnCancel.Location = new Point(170, 170);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(75, 30);
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = true;

            // GameModeDialog
            this.AcceptButton = this.btnOK;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new Size(330, 220);
            this.Controls.AddRange(new Control[] {
                this.lblTitle,
                this.radioHumanVsHuman,
                this.radioHumanVsAI,
                this.radioAIVsAI,
                this.btnOK,
                this.btnCancel
            });
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "GameModeDialog";
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "游戏模式选择";
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void GameModeDialog_Load(object sender, EventArgs e)
        {
            // 设置默认选择
            SelectedGameMode = GameMode.HumanVsHuman;
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (radioHumanVsHuman.Checked)
            {
                SelectedGameMode = GameMode.HumanVsHuman;
            }
            else if (radioHumanVsAI.Checked)
            {
                SelectedGameMode = GameMode.HumanVsAI;
            }
            else if (radioAIVsAI.Checked)
            {
                SelectedGameMode = GameMode.AIVsAI;
            }
        }
    }
} 